home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Info / TeachU14 / SAMS / Code / Day04 / readfile.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-08  |  406 b   |  22 lines

  1. #include <condefs.h>
  2. #include <fstream.h>
  3. #include <conio.h>
  4. #pragma hdrstop
  5.  
  6. int main(int, char **)
  7. {
  8.   char buff[80];
  9.   ifstream infile;
  10.   infile.open("readfile.cpp");
  11.   if (!infile) return 0;
  12.   while (!infile.eof()) {
  13.     infile.getline(buff, sizeof(buff));
  14.     cout << buff << endl;
  15.   }
  16.   infile.close();
  17.   cout << endl << "Press any key to continue...";
  18.   getch();
  19.   return 0;
  20. }
  21.  
  22.